package com.wuxiaofan.member.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.member.entity.MemberReceiveAddress;
import com.wuxiaofan.member.entity.custom.MemberReceiveAddressCustom;
import com.wuxiaofan.member.mapper.MemberReceiveAddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.member.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class MemberReceiveAddressService {
    @Autowired
    private MemberReceiveAddressMapper umsMemberReceiveAddressMapper;
    @Resource
    private Idgenerator idgenerator;
    public MemberReceiveAddress findById(String id){
        return umsMemberReceiveAddressMapper.selectById(id);
    }

    public MemberReceiveAddressCustom findCountByMap(Map paraMap){
        return umsMemberReceiveAddressMapper.findCountByMap(paraMap);
    }

    public MemberReceiveAddressCustom findGroupByMap(Map paraMap){
        return umsMemberReceiveAddressMapper.findGroupByMap(paraMap);
    }

    public List<MemberReceiveAddressCustom> findByMap(Map paraMap){
        return umsMemberReceiveAddressMapper.findByMap(paraMap);
    }

    public Page<MemberReceiveAddressCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(umsMemberReceiveAddressMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        umsMemberReceiveAddressMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        umsMemberReceiveAddressMapper.deleteById(id);
    }

    public MemberReceiveAddress save(MemberReceiveAddress umsMemberReceiveAddress){
        umsMemberReceiveAddress.setId(idgenerator.getId());
        umsMemberReceiveAddressMapper.insert(umsMemberReceiveAddress);
        return umsMemberReceiveAddress;
    }

}
